import { useState } from 'react'
import dayjs from 'dayjs'
import _ from 'lodash'
import './index.scss'
import { Button } from 'antd'

function App() {
  const [count, setCount] = useState(0)

  const data = [
    {
      date: '2024-07-01',
      value: 1,
      name: '1号'
    },
    {
      date: '2024-07-02',
      value: 2,
      name: '2号'
    },
    {
      date: '2024-05-11',
      value: 11,
      name: '11号'
    },
    {
      date: '2024-06-21',
      value: 21,
      name: '21号'
    },
  ]
  // 按月进行分组
  const monthGroup = _.groupBy(data, (item: any) => dayjs(item.date).format('YYYY-MM'))
  console.log(monthGroup)
  return (
    <>
      <h1>Vite + React</h1>
      <button onClick={() => setCount((count) => count + 1)}>
        count is {count}
      </button>
      <Button type="primary">按钮</Button>
    </>
  )
}

export default App
